home *** CD-ROM | disk | FTP | other *** search
Korn shell script | 1995-03-24 | 1.1 KB | 50 lines |
- #! /bin/ksh
- USAGE='USAGE: check_links [ -d config_prefix ] [ ROOT_DIR ]
- Check for links below ROOT_DIR which should be replaced and replace
- them.
- Uses ISOFS_UTIL_DIR and ${ISOFS_UTIL_DIR}/${CONFIG_PREFIX}config to set
- MOUNT_PATH and MAP_TO_PATH
- '
- # (C) Copyright 1995 by Michael Coulter. All rights reserved.
-
- # Process parameters
-
- CONFIG_PREFIX=""
- if [ $# -ge 2 -a "$1" = "-d" ]
- then
- shift # done with -d
- CONFIG_PREFIX="$1"; shift
- fi
- if [ $# -gt 1 ]
- then
- echo "$USAGE" >&2
- echo "Too many arguments." >&2
- exit 1
- fi
- ROOT_DIR="/"
- if [ $# -eq 1 ]
- then
- ROOT_DIR="$1"; shift
- fi
-
- # Set variables
-
- ISOFS_UTIL_DIR="${ISOFS_UTIL_DIR:-/usr/src/linux/fs/isofs/Utils}"
- . "$ISOFS_UTIL_DIR/ksh_fns"
- . "${ISOFS_UTIL_DIR}/${CONFIG_PREFIX}config"
- export ISOFS_UTIL_DIR
-
- # Of the link files, find those which point to a file below $MOUNT_PATH and
- # for which the equivalent link exists below $MAP_TO_PATH
-
- HERE="$PWD"
-
- # Do it
-
- echo "Checking links below $ROOT_DIR"
-
- ${FIND_LINKS} "$ROOT_DIR" | while read FILE REST
- do
- check_one_link "$FILE" "$MOUNT_PATH" "$MAP_TO_PATH"
- done
-